package com.pkx.cloud.fse7.dms.device.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.cloud.fse7.dms.device.entity.Device;
import com.pkx.cloud.fse7.dms.device.service.DeviceService;
import com.pkx.cloud.whzx.comn.ORpose;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 主控 控制器
 *
 * @author ly
 * @since 2020-10-14
 */
@RestController
@RequestMapping("/dms/device")
@Api(value = "主控", tags = "主控")
@Slf4j
@ORpose
public class DeviceController {

    @Autowired
    private DeviceService deviceService;

    @ApiOperation("主控分页列表")
    @GetMapping("/page")
    public Page<Device> page(Page page, Device device) {
        return deviceService.pageList(page, device);
    }

    @ApiOperation("主控列表")
    @GetMapping("/list")
    public List<Device> list(Device device) {
        return deviceService.listByEntity(device);
    }

    @ApiOperation("主控详情")
    @GetMapping(value = "/{id}")
    public Device selectById(@PathVariable("id") Long id) {
        return deviceService.selectById(id);
    }

}
